<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page contentType="text/html; charset=UTF-8" %>
<html>
	<head>
	    <title>Spring 3 MVC POLICE OP!!</title>
            <meta http-equiv="content-type" content="text/html; charset=UTF-8">
	</head>
	<body>
		 
		<h2>Contact Manager</h2>
		 
		<form:form method="post" action="add.html" commandName="dossier">
		    <table>
			    <tr>
			        <td><form:label path="prenom"><spring:message code="label.firstname"/></form:label></td>
			        <td><form:input path="prenom" /></td> 
			    </tr>
			    <tr>
			        <td><form:label path="nom"><spring:message code="label.lastname"/></form:label></td>
			        <td><form:input path="nom" /></td>
			    </tr>
			    <tr>
			        <td><form:label path="noPermis"><spring:message code="label.noPermis"/></form:label></td>
			        <td><form:input path="noPermis" /></td>
			    </tr>
			    <tr>
			        <td><form:label path="noPlaque"><spring:message code="label.noPlaque"/></form:label></td>
			        <td><form:input path="noPlaque" /></td>
			    </tr>
			    <tr>
			        <td colspan="2">
			            <input type="submit" value="<spring:message code="label.addDossier"/>"/>
			        </td>
			    </tr>
			</table>  
		</form:form>
		    
		<h3>Dossier</h3>
		<c:if  test="${!empty dossierList}">
			<table class="data">
				<tr>
				    <th><spring:message code="label.firstname"/></th>
				    <th><spring:message code="label.lastname"/></th>
				    <th><spring:message code="label.noPermis"/></th>
				    <th><spring:message code="label.noPlaque"/></th>
				</tr>
				<c:forEach items="${dossierList}" var="dossier">
				    <tr>
				        <td>${dossier.nom}, ${dossier.prenom} </td>
				        <td>${dossier.noPermis}</td>
				        <td>${dossier.noPlaque}</td>
				    </tr>
				</c:forEach>
			</table>
		</c:if>
	</body>
</html>